package com.exercise.api.feign;

import com.exercise.api.feignParam.UserLoginModule;
import com.exercise.api.feignParam.UserRegisterModule;
import com.exercise.commons.vo.Result;
import com.exercise.commons.vo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@FeignClient(name = "DeWu-storage-service",contextId = "userApi")
public interface UserApiFeign {

    /**
     * 注册用户
     *
     * @param userName
     * @param pwd
     * @return
     */
    @GetMapping("/user/register")
    public Result<User> register(@RequestBody UserRegisterModule userRegisterModule);

    /**
     * 执行登录逻辑，登录成功返回 User 对象
     *
     * @param userName
     * @param pwd
     * @return
     */
    @GetMapping("/user/login")
    public Result<User> login(@RequestBody UserLoginModule userLoginModule);
    //public Result<User> login(String userName, String pwd);

    /**
     * 获取多个用户信息
     *
     * @param userIds  查询参数
     * @return
     */
    @GetMapping("/user/queryUser")
    public List<User> queryUser(@RequestBody List<Long> userIds);

    /**
     * 判断是否登录
     *
     * @param request
     * @return
     */
    @GetMapping("/user/checkLogin")
    public Boolean checkLogin(@RequestBody HttpServletRequest request);
}
